package com.web.employees;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.service.EmployeesService;
import com.util.AuthenticateHttpServlet;

/**
 * Servlet implementation class ProductDelete
 */
@WebServlet("/Employee/Delete")
public class EmployeeDelete extends AuthenticateHttpServlet {
	private static final long serialVersionUID = 1L;

	protected void post(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		try {
			String employeeId = request.getParameter("code");
			EmployeesService service = new EmployeesService();
			service.deleteEmployeeById(employeeId);
		} catch (NumberFormatException ex) {
			ex.printStackTrace();
		}
		request.getRequestDispatcher("../Employee/List").forward(request,
				response);
	}

}
